package com.carpedil.smvc.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/** @author Administrator */
@Component
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("users")
public class User implements Serializable {
  /** value与数据库主键列名一致，若实体类属性名与表主键列名一致可省略value */
  @TableId(value = "id", type = IdType.AUTO)
  private Integer id;
  /** 若没有开启驼峰命名，或者表中列名不符合驼峰规则，可通过该注解指定数据库表中的列名，exist标明数据表中有没有对应列 */
  @TableField(value = "user_name", exist = true)
  private String userName;

  @TableField(value = "pass_word", exist = true)
  private String passWord;

  @TableField(value = "nick_name", exist = true)
  private String nickName;

  @TableField(value = "reg_time", exist = true)
  private Date regTime;
  /** 由于数据库users这张表没有这个字段,所以需要排除它 */
  @TableField(exist = false)
  private List<Role> roles;
}
